#@token()
<input type="hidden" class="layui-input" name="purchaseDetail.orderId" value="#(purchaseDetail.orderId??)"/>
<input type="hidden" class="layui-input" name="purchaseDetail.detailId" value="#(purchaseDetail.detailId??)"/>
<div class="layui-row layui-col-space1 task-row">
	#@colStart("物品名称",6)
	<input id="entityId" type="hidden" class="layui-input" name="purchaseDetail.entityId" value="#(purchaseDetail.entity_id??)"/>
	<input id="entityName" type="text" class="layui-input" name="purchaseDetail.entityName" value="#(purchaseDetail.entity_name??)"/>
	#@colEnd()
	#@colStart("所属上级",6)
	<input id="parEntityName" type="text" class="layui-input" name="purchaseDetail.parEntityName" value="#(purchaseDetail.par_entity_name??)"/>
	<input id="parEntityId" type="hidden" class="layui-input" name="purchaseDetail.parEntity" value="#(purchaseDetail.par_entity??)"/>
	#@colEnd()
</div>
<div class="layui-row layui-col-space1 task-row">
	#@colStart("计量单位",6)
	<input type="text" class="layui-input" name="purchaseDetail.unit" value="#(purchaseDetail.unit??)"/>
	#@colEnd()
	#@colStart("数量",6)
	<input type="text" class="layui-input" name="purchaseDetail.amount" value="#(purchaseDetail.amount??)"/>
	#@colEnd()
</div>
<div class="layui-row layui-col-space1 task-row">
	#@colStart("价格",6)
	<input type="text" class="layui-input" name="purchaseDetail.price" value="#(purchaseDetail.price??)"/>
	#@colEnd()
	#@colStart("折扣",6)
	<input type="text" class="layui-input" name="purchaseDetail.discount" value="#(purchaseDetail.discount??)"/>
	#@colEnd()
</div>
<div class="layui-row layui-col-space1 task-row">
	#@colStart("金额",6)
	<input type="text" class="layui-input" name="purchaseDetail.sumMoney" value="#(purchaseDetail.sum_money??)"/>
	#@colEnd()
</div>

#@submitButton2(3)

<!-- 弹窗展示物品树形层次 -->
#define layuiFunc()
    $("#entityName").on('click',function () {
        openDialogReturn("物品树形展示窗口","#(path)/erp/info/entity/index",false,null,null,null,function (res) {
            var entityId = res.entityId;
            var entityName = res.entityName;
            $("#entityName").val(entityName);
            $("#entityId").val(entityId);
            // 后台发起请求，查询父级物品信息
            $.ajax({
                type: 'post',
                url: '#(path)/erp/info/entity/getParent',
                data: {
                    entityId:entityId
                },
                async: true,
                dataType: 'json',
                success: function (result) {
                    // input框值回填
                    var parEntityName = result.entity_name;
                    var parEntityId = result.entity_id;
                    $("#parEntityName").val(parEntityName);
                    $("#parEntityId").val(parEntityId);
                }
            });
        });
    })

#end
